# @Filename:    Python的推导式应用
# @Author:      王佳伟
# @Time:        2025-02-06 15:44
# @Describe:

list = [i + j + k for i in "ABCD" for j in "ABCD" if i != j for k in "ABCD" if k not in j + i]
print(list)
# ['ABC', 'ABD', 'ACB', 'ACD', 'ADB', 'ADC', 'BAC', 'BAD', 'BCA', 'BCD', 'BDA', 'BDC', 'CAB', 'CAD', 'CBA', 'CBD', 'CDA', 'CDB', 'DAB', 'DAC', 'DBA', 'DBC', 'DCA', 'DCB']

a = [i + j + k for i in "ABCD" for j in "ABCD" if i != j for k in "ABCD" if k not in j + i]
print(set(map(lambda x: tuple(sorted(x)), a)))